<?php
namespace app\stores\model\member;

use app\common\model\CommonModel;
use think\facade\Db;

class WhiteListModel extends CommonModel{
    protected  $name = 'beautiful_white_list';
    protected  $pk   = 'white_list_id';

    /**
     * 模型写入前事件（钩子函数）
     */
    public static function onBeforeInsert($model)
    {
        $model->set("add_time", date('Y-m-d H:i:s'));
        $model->set("add_ip", request()->ip());
    }
    public static function getById($where,$field='*')
    {
        $list = Db::name('beautiful_white_list')->where($where)->field($field)->find();

        return $list;
    }

}
